package com.neusoft.chanceserver.controller;


import com.neusoft.chanceserver.dto.ChanceSearch;
import com.neusoft.chanceserver.dto.RespBean;
import com.neusoft.chanceserver.entity.Chance;
import com.neusoft.chanceserver.entity.Customer;
import com.neusoft.chanceserver.service.IChanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 主机会表 前端控制器
 * </p>
 *
 * @author liuxp
 * @since 2021-07-12
 */
@RestController
@RequestMapping("/chance")
public class ChanceController {
    @Autowired
    IChanceService iChanceService;

    @PostMapping("/searchChance")
    RespBean searchChance(@RequestBody ChanceSearch chanceSearch){
        return iChanceService.searchChance(chanceSearch);
    }

    @PostMapping("/addChance")
    RespBean addChance(@RequestBody Chance chance){
        return iChanceService.addChance(chance);
    }

    @PostMapping("/deleteChance/{id}")
    RespBean deleteChance(@PathVariable int id){
        return iChanceService.deleteChance(id);
    }

    @PostMapping("/updateChance")
    RespBean updateChance(@RequestBody Chance chance){
        return iChanceService.updateChance(chance);
    }

    @PostMapping("/queryAllChance")
    RespBean queryAllChance(){
        return iChanceService.queryAllChance();
    }

    @PostMapping("/getChanceByCustomer")
    RespBean getChanceByCustomer(@RequestBody Customer customer){
        return iChanceService.getChanceByCustomer(customer);
    }

}

